C++ : Why Is This Undefined Behavior